import numpy as np
import matplotlib.pyplot as plt
import os
from matplotlib.colors import LogNorm

fname = 'exfig8a.npz'

# load npz file
data = np.load(fname, allow_pickle=True)
print(data.files)
Rxx = data['Rxx']
nu_cut = data['nu_cut']
n_cut = data['n']
Rxx_cut = data['Rxx_cut']
n = data['n']
Vtg = data['Vtg']
Vbg = data['Vbg']
n0 = data['n0'] # density at charge neutrality point
D0 = data['D0'] 
ns = data['ns'] # density at 4 electron per moire unit cell
device_name = data['device_name']
back_gate_thickness_nm = data['back_gate_thickness_nm']
top_gate_thickness_nm = data['top_gate_thickness_nm']

# plot
fig = plt.figure(figsize=(6,4))
ax = fig.add_subplot(111)

plt.plot(nu_cut,Rxx_cut/1e3)

ax.set_xlabel(r'$\nu$')
ax.set_ylabel(r'$R_{xx}$ (k$\Omega$)')
ax.set_ylim([0,17])
ax.set_title('exfig8a')
plt.show()